<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent{
             width: 500px;
            height: 500px;
            border: 1px solid red;
            margin: 0 auto;
            display: flex;
              flex-direction: row;
              flex-wrap: wrap;
        }
        .child{
            /* width: 100px; */
            /* 将父容器分为3份  */
            flex:2 ;
            height: 60px;
            color: white;
        }
        .second{
            flex: 4   ;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child" style="background-color:red;">弹性元素1</div>
        <div class="child" style="background-color: red;">弹性元素2</div>
        <div class="child second" style="background-color: green;">弹性元素3</div>
        <div class="child" style="background-color: red;">弹性元素4</div>
        <div class="child" style="background-color: red;">弹性元素5</div>
        <div class="child" style="background-color: blue;">弹性元素6</div>
        <div class="child" style="background-color: blue;">弹性元素7</div>
        <div class="child" style="background-color: blue;">弹性元素8</div>
        <div class="child" style="background-color: blue;">弹性元素9</div>
    </div>
</body>
</html>